/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package p3as.cliente;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

/**
 *
 * @author Josue
 */
public class JDoubleBufferedCanvas extends JPanel{
    private Image image;

    public JDoubleBufferedCanvas() {
        super();
        this.setFocusable(true);
    }
    
    @Override
    public void paint(Graphics g){
       update(g); 
    }
    
    @Override
    public void update(Graphics g){
        g.drawImage(image, 0, 0, this);
    }
    
    public Image getImage(){
        image = createImage(this.getWidth(), this.getHeight());
        return image;
    }
}
